<script>
  import dayjs from 'dayjs';

  export default {
    methods: {
      dayjs,
      setImageStyle(w, h) {
        return {
          width: w + 'rpx',
          height: h + 'rpx',
          borderRadius: '50%',
        };
      },
      messageScrolltolower() {
        uni.$emit('messageScrolltolower');
      },
    },
    props: {
      height: {
        type: String,
        default: '',
      },
      messageList: {
        type: Array,
        default() {
          return [];
        },
      },
    },
  };

</script>

<template>
  <scroll-view class="wh_750 flex flex-column align-center"
               :scroll-y="true"
               :style="{
                  height:height
               }"
               :lower-threshold="150"
               @scrolltolower="messageScrolltolower"
  >
    <view class="wh_750 flex flex-column align-center">
      <view class="hW_20"></view>
      <view class="messageList flex ss-m-b-20" v-for="(item,index) in messageList" :key="index">
        <!--        <image :style="setImageStyle(63,63)" :src="`${item.avatar}`"></image>-->
        <view class="comments ss-m-l-17">
          <view class="comments_content">
            <view class="fs_30 fw_500 color_4B4B4B">{{ item.title }}:</view>
            <view class="fs_30 fw_500 color_4B4B4B ml_35">{{ item.content }}</view>
          </view>
          <!--          <view class="time flex justify-end align-center ss-m-t-6">-->
          <!--            {{ dayjs(item.add_time * 1000).format('YYYY年MM月DD日 HH:mm:ss') }}-->
          <!--          </view>-->
        </view>
      </view>
    </view>
    <view class="hW_100"></view>
  </scroll-view>
</template>

<style scoped lang="scss">
  .messageList {
    width: 662rpx;
    background: #FFFFFF;
    border-radius: 20rpx 20rpx 20rpx 20rpx;
    padding: 20rpx;

    .comments {
      .comments_content {
        width: auto;
        font-family: PingFang SC, PingFang SC;
        font-weight: 500;
        font-size: 27rpx;
        color: #292929;
      }

      .time {
        width: 567rpx;
        font-family: PingFang SC, PingFang SC;
        font-weight: 500;
        font-size: 24rpx;
        color: #4B4B4B;
      }
    }
  }
</style>